package cn.lg.soar.system.feign.fallback;

import cn.lg.soar.system.api.model.LogConfigDTO;
import cn.lg.soar.system.feign.LogConfigApiFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.Collections;
import java.util.List;

/**
 * 操作日志配置
 * @author luguoxiang
 * @date 2021-08-11
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class LogConfigApiFallbackFactory implements FallbackFactory<LogConfigApiFeign> {

    protected static final Logger LOGGER = LoggerFactory.getLogger(LogConfigApiFallbackFactory.class);

    @Override
    public LogConfigApiFeign create(Throwable cause) {
        return new LogConfigApiFeign() {
            @Override
            public List<LogConfigDTO> getAll() {
                LOGGER.error("getAll", cause);
                return Collections.emptyList();
            }
        };
    }
}
